package nl.infodation.emr.pricingservice.controller;

import nl.infodation.emr.pricingservice.data.AppliesSelection;
import nl.infodation.emr.pricingservice.data.DomainRuleSearchItem;
import nl.infodation.emr.pricingservice.data.ProductSelection;
import nl.infodation.emr.pricingservice.data.PromotionConnectedSelection;
import nl.infodation.emr.pricingservice.data.PublishedHistorySearchItem;
import nl.infodation.emr.pricingservice.data.UserSearchItem;
import nl.infodation.emr.pricingservice.entity.DomainListSetting;
import nl.infodation.emr.pricingservice.entity.DomainRule;
import nl.infodation.emr.pricingservice.entity.Environment;
import nl.infodation.emr.pricingservice.entity.LanguageSystem;
import nl.infodation.emr.pricingservice.entity.PublishedHistory;
import nl.infodation.emr.pricingservice.entity.Role;
import nl.infodation.emr.pricingservice.entity.SystemValue;
import nl.infodation.emr.pricingservice.entity.SystemValueRef;
import nl.infodation.emr.pricingservice.entity.SystemValueRole;
import nl.infodation.emr.pricingservice.entity.User;
import nl.infodation.emr.psrefdata.entity.SalesSupport;

public final class ControllerFactory {
	
	private static IController<SystemValue, SystemValue, Integer> systemValueController;
	private static IController<SystemValueRef, SystemValueRef, Integer> systemValueRefController;
	private static IController<SystemValueRole, SystemValueRole, Integer> systemValueRoleController;
	private static IController<DomainRule, DomainRuleSearchItem, Long> domainRuleController;
	private static IController<Environment, Object, Integer > environmentController;
	private static IController<User, UserSearchItem, String> userController;
	private static IController<Role, Role, Integer> roleController;
	private static IController<Object, ProductSelection, Integer> productSelectionController;
	private static IController<Object, AppliesSelection, Integer> appliesSelectionController;
	private static IController<Object, PromotionConnectedSelection, Integer> promotionConnectedSelectionController;
	 
	private static IController<PublishedHistory, PublishedHistorySearchItem, Long> publishedHistoryController;
	private static IController<LanguageSystem, LanguageSystem, Integer> languageSystemController;
	private static IController<DomainListSetting, DomainListSetting, Integer> domainSettingController;
	private static IController<SalesSupport, SalesSupport, Long> salesSupportController;
	
	private ControllerFactory() {
	}
	
	public synchronized static IController<SystemValue, SystemValue, Integer> getSystemValueController(){
		if (systemValueController == null){
			systemValueController = new SystemValueController();
		}
		return systemValueController;
	}
	
	public synchronized static IController<SystemValueRef, SystemValueRef, Integer> getSystemValueRefController(){
		if (systemValueRefController == null){
			systemValueRefController = new SystemValueRefController();
		}
		return systemValueRefController;
	}
	
	public synchronized static IController<SystemValueRole, SystemValueRole, Integer> getSystemValueRoleController(){
		if (systemValueRoleController == null){
			systemValueRoleController = new SystemValueRoleController();
		}
		return systemValueRoleController;
	}
	
	public synchronized static IController<LanguageSystem, LanguageSystem, Integer> getLanguageSystemController(){
		if (languageSystemController == null){
			languageSystemController = new LanguageSystemController();
		}
		return languageSystemController;
	}
	
	public synchronized static IController<Object, PromotionConnectedSelection, Integer> getPromotionConnectedSelectionController(){
		if (promotionConnectedSelectionController == null){
			promotionConnectedSelectionController = new PromotionConnectedSelectionController();
		}
		return promotionConnectedSelectionController;
	}
	
	public synchronized static IController<Object, AppliesSelection, Integer> getAppliesSelectionController(){
		if (appliesSelectionController == null){
			appliesSelectionController = new AppliesSelectionController();
		}
		return appliesSelectionController;
	}
	
	public synchronized static IController<Object, ProductSelection, Integer> getProductSelectionController(){
		if (productSelectionController == null){
			productSelectionController = new ProductSelectionController();
		}
		return productSelectionController;
	}
	
	public synchronized static IController<DomainRule, DomainRuleSearchItem, Long> getDomainRuleController() {
		if (domainRuleController == null){
			domainRuleController = new DomainRuleController();
		}
		return domainRuleController;
	}
	
	public synchronized static IController<Environment, Object, Integer > getEnvironmentController(){
		if (environmentController == null){
			environmentController = new EnvironmentController();
		}
		return environmentController;
	}
	
	public synchronized static IController<User, UserSearchItem, String> getUserController(){
		if (userController == null){
			userController = new UserController();
		}
		return userController;
	}
	
	public synchronized static IController<Role, Role, Integer> getRoleController(){
		if (roleController == null){
			roleController = new RoleController();
		}
		return roleController;
	}
	 
	
	public synchronized static IController<PublishedHistory, PublishedHistorySearchItem, Long> getPublishedHistoryController(){
		if (publishedHistoryController == null){
			publishedHistoryController = new PublishedHistoryController();
		}
		return publishedHistoryController;
	}
	
	public synchronized static IController<DomainListSetting, DomainListSetting, Integer> getDomainSettingController(){
		if (domainSettingController == null){
			domainSettingController = new DomainSettingController();
		}
		return domainSettingController;
	}
	
	public synchronized static IController<SalesSupport, SalesSupport, Long> getSalesSupportController(){
		if (salesSupportController == null){
			salesSupportController = new SalesSupportController();
		}
		return salesSupportController;
	}
	
}
